package com.test.hanlp.participle.po;

import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.sql.Timestamp;


/**
 * @Package: com.test.hanlp.participle.po
 * @ClassName CustomTermPo
 * @Description: 自定义术语对象
 * @Author: ky.zhang
 * @Date 2024/7/16 18:38
 * @Version v1.0
 **/
@Data
@Entity
@Table(name = "tm_custom_term")
@Accessors(chain = true)
public class CustomTermPo {

  @Id
  private String word;

  private String replacement;

  private String abbreviation;

  private String comment;

  @Column(nullable = false)
  private Boolean deleted = false;

  @Column(name = "created_at", updatable = false)
  private Timestamp createdAt;

  @Column(name = "updated_at")
  private Timestamp updatedAt;

  @PrePersist
  protected void onCreate() {
    createdAt = new Timestamp(System.currentTimeMillis());
    updatedAt = new Timestamp(System.currentTimeMillis());
  }

  @PreUpdate
  protected void onUpdate() {
    updatedAt = new Timestamp(System.currentTimeMillis());
  }
}
